<template>
	<view class="container">
		<scroll-view v-if="true" scroll-y="true" class="scroll">
			<view v-for="(item, index) in list" :key="index" @click="toDetail(item.id)" class="card">
				<view class="title flex-row">
					<view class="name">主题：{{ item.topic }}</view>
				</view>
				<view class="item flex-row">
					<view>负责人：{{ item.respons_man }}</view>
					<view style="width: 50%;">主讲：{{ item.host_man }}</view>
				</view>
				<view class="item"><view>参会人数：{{ item.user_num }}人</view></view>
				<view class="item"><view>开始时间：{{ item.starttime }}</view></view>
				<view class="item"><view>结束时间：{{ item.overtime }}</view></view>
				<view class="item"><view>会议地址：{{ item.address }}</view></view>
				<view class="item flex-row btns">
					<view class="btn">{{ item.joc == 1 ? '我创建的' : '我参与的' }}</view>
					<view v-if="item.status == 1" class="btn">未开始</view>
					<view v-if="item.status == 2" class="btn doing">进行中</view>
					<view v-if="item.status == 3" class="btn done">已完成</view>
				</view>
			</view>
			<view class="nodata">没有更多了~</view>
		</scroll-view>
		<view v-else class="nodata">没有更多了~</view>
	</view>
</template>

<script>
export default{
	data(){
		return {
			userid: uni.getStorageSync('userid'),
			page: 1,
			total: 1,
			list: []
		}
	},
	onLoad(){
		this.getList();
	},
	methods: {
		// 详情页
		toDetail(id){
			uni.navigateTo({
				url: 'detail?id='+id
			})
		},
		// 获取列表
		getList(){
			let _this = this;
			uni.request({
				url: this.$API.eduSafeMeetingMyMeeting,
				data: { userid: this.userid, type: 'join' },
				header: this.$API.get_head(),
				success: (res)=>{
					_this.total = res.data.total;
					
					// 判断是第一页还是后续页
					let data = res.data.rows;
					if(_this.page == 1){
						_this.list = data;
					}else{
						_this.list = _this.list.concat(data);
					}
				}
			})
		},
		// 分页加载
		getNextPageData(){
			this.page++;
			if(this.page < this.total){
				this.getList();
			}
		}
	}
}
</script>


<style scoped>
.container,
.scroll{
	height: 100vh;
}
/*列表*/
.card{
	margin: 20upx 20upx 0;
	border-radius: 16upx;
	background: #fff;
	padding: 14upx 20upx 8upx;
	border: 2upx solid #F6F6F6;
	box-shadow: 0 0 4upx #eee;
}
.card .title{
	margin-bottom: 6upx;
}
.card .title view{
	height: 42upx;
	font-size: 28upx;
}
.card .title view.name{
	text-indent: 20upx;
	position: relative;
}
.card .title view.name::before{
	content: '';
	width: 10upx;
	height: 26upx;
	background: #5F96F2;
	border-radius: 4upx;
	position: absolute;
	top: 14upx;
	left: 0;
}
.card .item{
	text-indent: 20upx;
}
.card .item text{
	color: #999;
	margin-right: 40upx;
}
.card .item.btns{
	margin-bottom: 16upx;
	padding-left: 20upx;
	padding-top: 10upx;
	justify-content: flex-start;
}
.card .item.btns .btn{
	color: #fff;
	width: 160upx;
	height: 52upx;
	font-size: 26upx;
	line-height: 52upx;
	border-radius: 6upx;
	text-align: center;
	text-indent: 0;
	margin-right: 20upx;
	background-color: #1692DC;
}
.card .item.btns .btn.doing{
	background-color: #EB6438;
}
.card .item.btns .btn.done{
	background-color: #0AD121;
}
</style>
